package com.dream.vo.api;

import java.io.Serializable;
import java.lang.reflect.Type;

import com.google.gson.Gson;

public class ApiResult implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7580068595122061757L;

	private boolean result = true;

	private String message;

	public boolean isResult() {
		return result;
	}

	public void setResult(boolean result) {
		this.result = result;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}
	
	/**
	 * 把数据转换成对象
	 * @param type
	 * @return
	 */
	public <E> E fromMsgJson(Type type){
		
		E result = null;
		if( message == null || message.isEmpty()){
			return result;
		}
		
		result = new Gson().fromJson(message, type);
		
		return result;
	}

}
